<template>
  <el-card class="box-card">
    <div slot="header"
         class="clearfix">
      <span>账户信息</span>
    </div>
    <el-form ref="adminForm"
             label-width="100px">
      <el-form-item label="公司全称">
        <span>{{ adminValue.name || "--" }}</span>
      </el-form-item>
      <el-form-item label="公司编号">
        <span>{{ adminValue.code || "--" }}</span>
      </el-form-item>
      <el-form-item label="登录账号">
        <span>{{ `admin@${adminValue.alias}` || "--" }}</span>
      </el-form-item>
      <el-form-item label="实名认证">
        <span>已认证 <i class="el-icon-success icon-color" /></span>
      </el-form-item>
      <el-form-item label="注册时间">
        <span>{{ adminValue.createAt }}</span>
      </el-form-item>
      <el-form-item label="绑定开放平台">
        <span v-if="openAccount">
          {{ openAccount }}
          <span class="primary_color"
                @click="handleOpen">
            前往开放平台
            <icon-svg class-name="iconClass"
                      icon-name="chakan" />
          </span>
        </span>
        <div v-else>
          <el-button type="text"
                     size="small"
                     icon="el-icon-link"
                     @click="handleOpen">去绑定</el-button>
          <div class="tips">
            <icon-svg class-name="iconClass"
                      icon-name="jijiangguoqi" />
            没有绑定账号，需去开放平台进行绑定
          </div>
        </div>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script>
import platformConfig from "@/config/platformConfig";

export default {
  name: "UserInfo",
  props: {
    value: {
      type: Object,
      default: () => { }
    },
    open: {
      type: String,
      default: ""
    }
  },
  data () {
    return {
      // adminValue: {}
    }
  },
  computed: {
    openUrl () {
      return platformConfig.open[process.env.NODE_ENV] || "";
    },
    adminValue () {
      return this.value || {}
    },
    openAccount () {
      return this.open
    }
  },
  mounted () {
    // this.getAdminUserInfo()
  },
  methods: {
    handleOpen () {
      window.open(this.openUrl, "_blank");
    }
  }
}
</script>

<style lang="scss" scoped>
.box-card {
  height: calc(100vh - 100px);
}
.icon-color {
  color: #67c23a !important;
}
.tips {
  color: var(--prev-color-text-purered);
  font-size: 12px;
}
.primary_color {
  margin-left: 10px;
  color: var(--prev-color-primary);
  cursor: pointer;
}
</style>